<template>
  <div>
    <el-dropdown @command="getCommand">
      <span class="el-dropdown-link">
        <svg-icon style="color: #fff; font-size: 20px" icon-class="language" />
      </span>
      <el-dropdown-menu slot="dropdown">
        <!-- disabled 动态禁用 -->
        <el-dropdown-item
          command="zh"
          :disabled="$i18n.locale === 'zh'"
        >中文</el-dropdown-item>
        <el-dropdown-item
          command="en"
          :disabled="$i18n.locale === 'en'"
        >English</el-dropdown-item>
      </el-dropdown-menu>
    </el-dropdown>
  </div>
</template>

<script>
export default {
  name: 'Lang',
  methods: {
    getCommand(val) {
      this.$i18n.locale = val
    }
  }
}
</script>

<style>
</style>
